<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?=$param['aname'];?>补打分</title>
    <script src="jquery-1.9.1min.js"></script>
    <link rel="stylesheet" href="bootstrap.min.css">
    <script src="bootstrap.min.js"></script>
</head>
<style>
    table{
        border-collapse:collapse;
        table-layout:fixed;
        border-radius:5px;
        overflow:hidden;
        margin: 10px auto;
        border:2px solid #70aefb ;
        background-color: #1f5a9c;
        color: #fafafb;
    }
    table td,th{
        /* padding: 5px;
        width: 33%; */
        text-align: center;
        border:1px solid #70aefb ;
        vertical-align:middle;
        /* font-size: 15px; */
        width: 7rem;
    }
    a{
        color: red;
    }
    #edit div{
        margin-bottom: 10%;
    }
    label{
        width: 7rem;
    }
</style>
<body style="text-align: center;">
<table>
    <thead>
        <tr>
            <th>汇报者</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
    <?php foreach($list as $val):?>
    <tr>
        <td><?=$val['name'];?></td>
        <td>
            <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick='create("<?=$val['id'];?>","<?=$val['name'];?>")'>补打分</button>
        </td>
    </tr>
    <?php endforeach;?>
    </tbody>
</table>

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">

                <h4 class="modal-title" id="myModalLabel" style="text-align: center;width: 28rem;">
                    打分
                </h4>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
            </div>
            <div class="modal-body">
                <p>
                    <label>汇报者:</label>
                    <span id="user_name" style="color: red"></span>
                </p>

                <input type="hidden" id="name" value=""/>
                <input type="hidden" id="user_id" value=""/>
                <div>
                    <label>PPT形象&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_first" value=""/>
                </div>
                <div>
                    <label>个人形象&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_second" value=""/>
                </div>
                <div>
                    <label>演讲台风&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
                    <input id="original_third" value=""/>
                </div>
                <div>
                    <label>目标数据呈现:</label>
                    <input id="original_fourth" value=""/>
                </div>
                <div>
                    <label>任务清单呈现:</label>
                    <input id="original_fifth" value=""/>
                </div>
                <div>
                    <label>达成路径呈现:</label>
                    <input id="original_sixth" value=""/>
                </div>
                <div>
                    <label>创新思维呈现:</label>
                    <input id="original_seventh" value=""/>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
                <button type="button" onclick="createsave()" class="btn btn-primary">
                    打分
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<a href="javascript:history.back(-1)" class="btn btn-primary btn-lg" role="button">返回</a>
</body>
</html>
<script>
    function create(user_id,user_name) {
        $('#user_id').val(user_id);
        $('#name').val(user_name);
        $('#user_name').text(user_name);
    }
    function createsave() {
        var user_id = $('#user_id').val();
        var user_name = $('#name').val();
        // var Assessor_id = $('#Assessor_id').val();
        // var Assessor_name = $('#Assessor_name').val();
        var original_first = $('#original_first').val();
        var original_second = $('#original_second').val();
        var original_third = $('#original_third').val();
        var original_fourth = $('#original_fourth').val();
        var original_fifth = $('#original_fifth').val();
        var original_sixth = $('#original_sixth').val();
        var original_seventh = $('#original_seventh').val();

        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_first);
        console.log(flag)
        if (!flag){
            alert('PPT形象打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_second);
        if (!flag){
            alert('个人形象分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_third);
        if (!flag){
            alert('演讲台风分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_fourth);
        console.log(flag)
        if (!flag){
            alert('目标数据呈现打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_fifth);
        if (!flag){
            alert('任务清单呈现分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_sixth);
        if (!flag){
            alert('达成路径呈现分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(original_seventh);

        if (!flag){
            alert('创新思维呈现打分有误，请检查');
            return false;
        }
        var score = [
            original_first,
            original_second,
            original_third,
            original_fourth,
            original_fifth,
            original_sixth,
            original_seventh
        ];
        $.ajax({url:"index.php",data:{
                'func':'score',
                'user_id' : user_id,
                'user_name' : user_name,
                'Assessor_id' : "<?=$param['aid'];?>",
                'Assessor_name' : "<?=$param['aname'];?>",
                'score' : score
                // 'original_first':original_first,
                // 'original_second':original_second,
                // 'original_third':original_third,

            },dataType:'json',success:function(result){
                if (result.code == '200'){
                    alert(result.message);
                    window.location.reload()
                }
            }});
    }
</script>